package com.lanswon.entity;

import java.text.SimpleDateFormat;
import java.util.Date;

import com.lanswon.common.enums.ProblemType;

public class CommonProblem {
    private Long id;

    private String name;

    private Date releaseTime;

    private String releaseTimeStr;
    
    private Integer readNum;

    private Byte problemType;
    
    private String problemTypeStr;

    private Date createTime;

    private Date updateTime;

    private String content;

    
    
    
    public String getProblemTypeStr() {
		return problemTypeStr = ProblemType.getValueByCode(this.getProblemType().intValue());
	}

	public void setProblemTypeStr(String problemTypeStr) {
		this.problemTypeStr = problemTypeStr;
	}

	public String getReleaseTimeStr() {
    	if(this.releaseTimeStr==null) {
    		releaseTimeStr = new SimpleDateFormat("yyyy-MM-dd").format(this.getReleaseTime());
    	}else {
    		releaseTimeStr = this.releaseTimeStr;
    	}
		return releaseTimeStr;
	}

	public void setReleaseTimeStr(String releaseTimeStr) {
		this.releaseTimeStr = releaseTimeStr;
	}
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public Date getReleaseTime() {
        return releaseTime;
    }

    public void setReleaseTime(Date releaseTime) {
        this.releaseTime = releaseTime;
    }

    public Integer getReadNum() {
        return readNum;
    }

    public void setReadNum(Integer readNum) {
        this.readNum = readNum;
    }

    public Byte getProblemType() {
        return problemType;
    }

    public void setProblemType(Byte problemType) {
        this.problemType = problemType;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content == null ? null : content.trim();
    }
}